/**
 * Copyright 2013 Impetus Infotech.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.impetus.client.oraclenosql.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.impetus.kundera.index.Index;
import com.impetus.kundera.index.IndexCollection;

/**
 * 
table create -name PERSON
add-field -type string -name PERSON_ID
add-field -type string -name PERSON_NAME
add-field -type integer -name AGE
primary-key -field PERSON_ID
exit
plan add-table -name PERSON -wait
 */

/**
 * Entity class for Person
 * 
 * @author amresh.singh
 */
@Entity
@Table(name = "PERSON_KV_STORE", schema = "OracleNoSqlTests@twikvstore")
@IndexCollection(columns = { @Index(indexName = "personName", name = "personName"),
        @Index(indexName = "age", name = "age"),
        @Index(indexName = "personId_age", name = "personId,age", type = "composite") })
@NamedQueries(value = { @NamedQuery(name = "findByAge", query = "Select p from PersonKVStore p where p.age=:age"),
        @NamedQuery(name = "findByName", query = "Select p from PersonKVStore p where p.personName = ?1") })
public class PersonKVStore
{

    /** The person id. */
    @Id
    @Column(name = "PERSON_ID")
    private String personId;

    /** The person name. */
    @Column(name = "PERSON_NAME")
    private String personName;

    /** The age. */
    @Column(name = "AGE")
    private Integer age;

    /**
     * Gets the person id.
     * 
     * @return the person id
     */
    public String getPersonId()
    {
        return personId;
    }

    /**
     * Gets the person name.
     * 
     * @return the person name
     */
    public String getPersonName()
    {
        return personName;
    }

    /**
     * Sets the person name.
     * 
     * @param personName
     *            the new person name
     */
    public void setPersonName(String personName)
    {
        this.personName = personName;
    }

    /**
     * Sets the person id.
     * 
     * @param personId
     *            the new person id
     */
    public void setPersonId(String personId)
    {
        this.personId = personId;
    }

    /**
     * @return the age
     */
    public int getAge()
    {
        return age;
    }

    /**
     * @param age
     *            the age to set
     */
    public void setAge(int age)
    {
        this.age = age;
    }

}
